package com.example.hospitalbakcends.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.example.hospitalbakcends.mapper.MedicinesMapper;
import com.example.hospitalbakcends.service.MedicinesService;

import com.example.hospitalbakcends.domain.Medicines;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
* @author cac_qin
* @description 针对表【medicines(药品)】的数据库操作Service实现
* @createDate 2024-05-22 17:29:59
*/
@Service
public class MedicinesServiceImpl extends ServiceImpl<MedicinesMapper, Medicines>
    implements MedicinesService{

    @Resource
    private MedicinesMapper medicinesMapper;

    @Override
    public Medicines getByName(String medName){
        QueryWrapper<Medicines> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("medName",medName);
        long count=medicinesMapper.selectCount(queryWrapper);
        if(count==0){
            return null;
        }
        Medicines medicines = medicinesMapper.selectOne(queryWrapper);
        return medicines;
    }

}




